<template>
  <div class="box1">
    <div class="title">
      <div>男女比例</div>
      <img src="../../images/dataScreen-title.png" alt="" />
    </div>
    <div class="sex">
      <div class="man">
        <img src="../../images/man.png" alt="" />
      </div>
      <div class="woman">
        <img src="../../images/woman.png" alt="" />
      </div>
    </div>
    <div class="rate">
      <div>男性58%</div>
      <div>女性42%</div>
    </div>
    <div class="charts" ref="charts"></div>
  </div>
</template>

<script setup lang="ts">
  import * as echarts from 'echarts'
  import { ref, onMounted } from 'vue'

  let charts = ref()
  onMounted(() => {
    let myCharts = echarts.init(charts.value)
    myCharts.setOption({
      xAxis: {
        show: false,
        min: 0,
        max: 100,
      },
      yAxis: {
        show: false,
        type: 'category',
      },
      series: [
        {
          type: 'bar',
          data: [58],
          barWidth: 20,
          z: 100,
          itemStyle: {
            borderRadius: 20,
            color: 'skyblue',
          },
        },
        {
          type: 'bar',
          data: [100],
          barWidth: 20,
          barGap: '-100%',
          itemStyle: {
            borderRadius: 20,
            color: 'pink',
          },
        },
      ],
      grid: {
        top: 0,
        right: 0,
        bottom: 0,
        left: 0,
      },
    })
  })
</script>

<style scoped lang="scss">
  .box1 {
    width: 100%;
    height: 100%;
    background: url(../../images/dataScreen-main-lc.png) no-repeat;
    background-size: 100% 100%;
    margin: 20px 0px;
    .title {
      div {
        color: white;
        font-size: 20px;
      }
    }
    .sex {
      display: flex;
      justify-content: center;
      margin-top: 20px;
      .man {
        margin-right: 80px;
        width: 111px;
        height: 115px;
        background: url(../../images/man-bg.png) no-repeat;
        display: flex;
        justify-content: center;
        align-items: center;
      }
      .woman {
        margin-left: 80px;
        width: 111px;
        height: 115px;
        background: url(../../images/woman-bg.png) no-repeat;
        display: flex;
        justify-content: center;
        align-items: center;
      }
    }
    .rate {
      margin-top: 20px;
      display: flex;
      justify-content: space-between;
      color: white;
    }
    .charts {
      height: 80px;
      // background:red;
    }
  }
</style>
